package com.zut.demo1.service.impl;

import com.zut.demo1.dao.IpphoneMapper;
import com.zut.demo1.model.IpphoneExample;
import com.zut.demo1.service.IpPhoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IpPhoneServiceImpl implements IpPhoneService {

    @Autowired
    private IpphoneMapper ipphoneMapper;


    @Override
    public int count1(String times) {
        IpphoneExample example = new IpphoneExample();

        IpphoneExample.Criteria criteria = example.createCriteria();

        criteria.andStarttimeLike(times+"%");

        criteria.andDnstateEqualTo("1");          //在使用

        return ipphoneMapper.countByExample(example);
    }

    @Override
    public int count2(String times) {
        IpphoneExample example = new IpphoneExample();

        IpphoneExample.Criteria criteria = example.createCriteria();

        criteria.andStarttimeLike(times+"%");

        criteria.andDnstateEqualTo("4");      //不可用

        return ipphoneMapper.countByExample(example);
    }

    @Override
    public int count3(String times) {
        IpphoneExample example = new IpphoneExample();

        IpphoneExample.Criteria criteria = example.createCriteria();

        criteria.andStarttimeLike(times+"%");

        criteria.andDnstateEqualTo("0");      //空闲

        return ipphoneMapper.countByExample(example);
    }

}
